import axios from 'axios';
const state = {
    productMan : {
        name:"你好商品",
        xzjiage:"912",
        shichangjiage:"3423"
    }
}

const getters = {

    getProduct : state=>state.productMan
    
}

const actions = {
    getProducts(context){
        axios({
            method:"post",
            url:'/product/fandNameAndNum',
            params: {
                limit:1,
                page:1,
                num:"20201112001",
                name:"娃哈哈AD钙奶"
            }
        }).then(response => {
            context.commit("setProducts",response.data);
        })
    }
}

const mutations = {
    setProducts(state,products) {
        state.productMan = products;
    }
}

export default {
    state,
    getters,
    actions,
    mutations
}